package com.atde._04_structural_design_patterns.facade;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._04_structural_design_patterns.facade
 * @Author: Del
 * @CreateTime: 2025-06-23  09:40
 * @Description: 外观模式 --- 影院外观
 * @Version: 1.0
 */
public class HomeTheaterFacade {

    // 剧院灯光
    private TheaterLight theaterLight;
    // 爆米花
    private Popcorn popcorn;
    // DVD播放器
    private DVDPlayer dvdPlayer;
    // 投影仪
    private Projector projector;
    // 音响
    private Stereo stereo;
    // 屏幕
    private Screen screen;

    public HomeTheaterFacade() {
        theaterLight = TheaterLight.getInstance();
        popcorn = Popcorn.getInstance();
        dvdPlayer = DVDPlayer.getInstance();
        projector = Projector.getInstance();
        stereo = Stereo.getInstance();
        screen = Screen.getInstance();
    }

    public void ready() {
        popcorn.on();
        popcorn.pop();
        screen.down();
        projector.on();
        stereo.on();
        dvdPlayer.on();
        theaterLight.dim();
    }

    public void play() {
        dvdPlayer.play();
    }

    public void pause() {
        dvdPlayer.pause();
    }

    public void end() {
        popcorn.off();
        theaterLight.bright();
        screen.up();
        projector.off();
        stereo.off();
        dvdPlayer.off();
    }
}
